Various embodiments of this disclosure relate to caching policies and, more particularly, to caching policies for selection and replacement of objects.
Main-memory caches are generally faster to access than secondary storage. The size of a cache limits the amount of data that can be stored there. Because a cache is generally smaller than secondary storage, data in the cache is regularly replaced to allow room for data that is likely to be used in the near future. Given a good replacement policy, a processor can quickly access data it needs by reading from the cache, thereby avoiding having to fetch the data from secondary storage.
Various cache replacement policies exist for replacing data in the cache with alternate data. A least-recently-used (LRU) method makes space in the cache for a newly accessed object by replacing a least-recently-used object. The LRU-K method replaces the object whose Kth most recent access is furthest in the past. The least-frequently-used (LFU) method replaces the object in the cache that has been accessed the fewest number of times.